package com.example.cd5160866.tabs.camera;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.example.cd5160866.tabs.R;

/**
 * Created by cd5160866 on 2018/8/24.
 */

public class DemoListActivity extends ListActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


        String[] itmes = {"TEST1", "TEST2","RXJAVA"};
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                R.layout.item_list, R.id.tv_item, itmes);
        this.setListAdapter(adapter);

    }

    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        switch (position) {
            case 0:
                startActivity(new Intent(this, CameraActivity.class));
                break;
            case 1:
                startActivity(new Intent(this, CameraViewActivity.class));
                break;
            case 2:
                startActivity(new Intent(this, RxDemo.class));
            default:
                break;
        }
        super.onListItemClick(l, v, position, id);
    }
}
